package com.cl.datasubscription;

import com.cl.chlorine.util.ClassGeneratorUtil;
import com.cl.datasubscription.entity.SubscribeKeywordTask;
import com.cl.datasubscription.schedule.SubscribeKeywordStarter;
import com.cl.datasubscription.task.SubscribeKeywordTaskExecutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication(scanBasePackages = {"com.cl"})
public class DataSubscriptionApplication  implements CommandLineRunner {
    @Autowired
    SubscribeKeywordStarter subscribeKeywordStarter;
    @Autowired
    SubscribeKeywordTaskExecutor subscribeKeywordTaskExecutor;

    public static void main(String[] args) {
        SpringApplication.run(DataSubscriptionApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
//        ClassGeneratorUtil.generate("/Users/chenlong/mine/data-subscription/src/main/java/com/cl/datasubscription","com.cl.datasubscription");
//        subscribeKeywordStarter.startAll();
        subscribeKeywordTaskExecutor.addData("test1");
        subscribeKeywordTaskExecutor.addData("test2");
        subscribeKeywordTaskExecutor.addData("test3");
        subscribeKeywordTaskExecutor.addData("tes4");
        subscribeKeywordTaskExecutor.addData("tes5");
        subscribeKeywordTaskExecutor.addData("test6");

    }
}
